#

| Chapter 2 UNIX Commands |

## tr

    tr [options] [string1 [string2]]

Copy standard input to standard output, performing substitution of characters from `string1` to `string2` or deletion of characters in `string1`.

### Options

-c

  Complement characters in `string1` with ASCII 001-377.

-d

  Delete characters in `string1` from output.

-s

  Squeeze out repeated output characters in `string2`.

### Examples

Change uppercase to lowercase in a file:

>     cat file | tr `[A-Z]` `[a-z]`

Turn spaces into newlines (ASCII code 012):

>     tr ' ' '\012' <file

Strip blank lines from file and save in new.file (or use \011 to change successive tabs into one tab):

>     cat file | tr -s "" "/012" > new.file

Delete colons from file; save result in new.file:

>     tr -d : <file > new.file

Reference: tput |  | Reference: troff